package com.pureut.production.controller;

import com.pureut.common.core.web.controller.BaseController;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.common.core.web.page.TableDataInfo;
import com.pureut.common.log.annotation.Log;
import com.pureut.common.log.enums.BusinessType;
import com.pureut.common.security.annotation.RequiresPermissions;
import com.pureut.production.domain.dto.ClothInspectionDto;
import com.pureut.production.domain.vo.ClothInspectionVo;
import com.pureut.production.domain.vo.ClothInspectionPdaVo;
import com.pureut.production.service.ClothInspectionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/***
 * 验布控制层
 * Author:C
 * Date:2023/02/20 10:29
 * @DESC
 */
@RestController
@RequestMapping("/cloth-inspection")
public class ClothInspectionController extends BaseController {


    @Resource
    ClothInspectionService clothInspectionService;

    /**
     * 验布列表
     */
    @RequiresPermissions("productionTube:produAdm:slitting:clothinspec:list")
    @GetMapping("/list")
    public TableDataInfo selectOperationList(ClothInspectionVo clothInspectionVo) {
        startPage();
        // 查询验布列表
        List<ClothInspectionDto> list = clothInspectionService.getList(clothInspectionVo);
        return getDataTable(list);
    }

    /**
     * 验布
     */
    @RequiresPermissions("productionTube:produAdm:slitting:clothinspec:cloth")
    @PostMapping("/clothInspection")
    @Log(title = "验布", businessType = BusinessType.UPDATE)
    public AjaxResult clothInspection(@RequestBody ClothInspectionPdaVo clothInspectionPdaVo) {
        return AjaxResult.success(clothInspectionService.clothInspection(clothInspectionPdaVo));
    }
}
